<template>

  <el-button @click="toadd">添加</el-button>

  <el-table :data="tableData" style="width: 100%">
    <el-table-column prop="id" label="ID"/>
    <el-table-column prop="phone_number" label="手机号"/>
    <el-table-column prop="name" label="姓名"/>
    <el-table-column prop="entry_date" label="入职日期"/>
    <el-table-column prop="role" label="角色"/>
    <el-table-column label="操作">
      <template #default>
        <el-button link type="primary" size="small" @click="handleClick">
          Detail
        </el-button>
<!--        <el-button link type="primary" size="small">Edit</el-button>-->
      </template>
    </el-table-column>
  </el-table>


</template>
<script setup>
import axios from "axios";
import {ref,onMounted} from "vue";
import {useRouter} from "vue-router";

let router = useRouter()
let tableData = ref([])

const findAll = ()=>{
  axios.get('http://localhost:8000/tadmin/users/').then(res=>{
    tableData.value = res.data
  })
}

const toadd = ()=>{
  router.push('/adminadd')
}


onMounted(()=>{
  findAll()
})
</script>
<style scoped>


</style>